(function ($) {
    $.fn.objTelnet = function (InIt) {

        var rdRadioTelnet;

        var controlMapExisting=new Array(0);
        var controlMapCurrent=new Array(0);

	var xmlName = '';

        this.onLoad = function () {
	    var index = 0;
	    this.loadHTML();
document.getElementById("title").innerHTML = jQuery.i18n.prop(InIt);
	    var xml = getData(xmlName);

            var mode;

            var arrayLabels = document.getElementsByTagName("label");
            lableLocaliztion(arrayLabels);

            var buttonID = document.getElementById("btUpdate").id;
            buttonLocaliztion(buttonID);

            enable_telnet=$(xml).find("enable_telnet").text();
            rdRadioTelnet.setRadioButton(enable_telnet);
            controlMapExisting = g_objXML.putMapElement(controlMapExisting,index++, "RGW/control_telnet/enable_telnet",mode);

            controlMapCurrent = g_objXML.copyArray(controlMapExisting,controlMapCurrent);
        }

        this.onPost = function () {
	    var _controlMap = this.getPostData();
	    if(_controlMap.length>0) {
		postXML("control_telnet", g_objXML.getXMLDocToString(g_objXML.createXML(_controlMap)));
		//this.onLoad();
	    }
        }
 this.onPostSuccess = function (){
        this.onLoad(false);
        }
        this.getPostData = function (){
            var index = 0;
            var mapData = new Array(0);
            controlMapCurrent[index++][1] = rdRadioTelnet.getRadioButton();

            mapData = g_objXML.copyArray(controlMapCurrent,mapData);
            mapData = g_objXML.getChangedArray(controlMapExisting,mapData,true);
            return mapData;
        }

        this.loadHTML =  function() {
	    document.getElementById('Content').innerHTML ="";
	    document.getElementById('Content').innerHTML = callProductHTML("html/router/control_telnet.html");
	    rdRadioTelnet = $("#rdRadioTelnet").enabled_disabled("rdRadioTelnet");
        }

        this.setXMLName = function (_xmlname){
            xmlName = _xmlname;
        }

        return this.each(function () {
	    });
    }
})(jQuery);

